#!/bin/bash
sed -i 's/^pool.*$//g' /etc/chrony.conf
sed  -i '3a pool ntp.aliyun.com iburst\npool ntp.tencent.com iburst' /etc/chrony.conf
sed -i '26a allow 192.168.88.0/24' /etc/chrony.conf
echo 'log measurements statistics tracking' >> /etc/chrony.conf
sed -i '37a \
    add_header Access-Control-Allow-Origin *;\
    add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE";\
    add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept, Authorization";' /etc/nginx/nginx.conf
        
sed -i '46a \
        location / {\
            root   /var/www/dist;\
            index  index.html index.htm;\
            proxy_set_header   Upgrade          $http_upgrade;\
            proxy_set_header   Connection       upgrade;\
            try_files $uri $uri/ /index.html;\
        }\
        location /prod-api/ {\
            proxy_pass http:\/\/192.168.88.102:8080\/zzyl-admin\/;\
            proxy_set_header   Upgrade          $http_upgrade;\
            proxy_set_header   Connection       upgrade;\
        }' /etc/nginx/nginx.conf
